package cn.easier.activity.console.service.impl;

import cn.easier.activity.console.repository.ActivityRuleRepository;
import cn.easier.activity.console.service.ActivityRuleInfoService;
import cn.easier.activity.web.entity.ActivityRule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 活动规则ServiceImpl
 */
@Service
@Transactional
public class ActivityRuleInfoServiceImpl implements ActivityRuleInfoService {

    @Autowired
    ActivityRuleRepository activityRuleRepository;

    @Override
    public ActivityRule findOneByActivityInfoId(Integer activityInfoId) {
        return activityRuleRepository.findActivityRuleByActivityInfoId(activityInfoId);
    }

    @Override
    public ActivityRule saveAndFlush(ActivityRule activityRule) {
        return activityRuleRepository.saveAndFlush(activityRule);
    }

    @Override
    public ActivityRule findOneByPrizeClaw(Integer activityInfoId, String prizeClawType) {
        return activityRuleRepository.findActivityRuleByActivityInfoIdAndPrizeClawType(activityInfoId,prizeClawType);
    }

    @Override
    public ActivityRule findPrizeClawByActivityInfoId(Integer activityInfoId,String PrizeClawType) {
        return activityRuleRepository.findPrizeClawByActivityInfoId(activityInfoId,PrizeClawType);
    }
}
